export const swipeCellBehavior = Behavior({
  data: {
    swipeCellQueue: []
  },
  methods: {
    //当用户打开滑块时触发
    swipeCellOpen(event) {
      const instance = this.selectComponent(`#${event.target.id}`)
      this.data.swipeCellQueue.push(instance)
    },
    //给页面绑定点击事件
    onSwipeCellPage() {
      this.onSwipeCellCommonClick()
    },
    //点击滑动单元格时触发的事件
    onSwipeCellClick() {
      this.onSwipeCellCommonClick()
    },
    //关掉滑块统一的逻辑
    onSwipeCellCommonClick() {
      //对单元格实例数组进行遍历，遍历以后获取每个实例，让每个实例调用close方法即可
      this.data.swipeCellQueue.forEach(instance => {
        instance.close()
      })
      this.data.swipeCellQueue = []
    },
  }
})